/*
    This file is part of Slydini.

    Slydini is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Slydini is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Slydini.  If not, see <http://www.gnu.org/licenses/>.
*/
#include "down_menu.h"
#include <QtGui>
#include "../painting/SWidget.h"

#include "moc_downmenu.h"


DownMenu::DownMenu(QWidget *parent):Down_form(){
	setupUi(this);
	connect(toolButtonR1, SIGNAL(clicked()), this, SLOT(changeColorRedUp()));
	connect(toolButtonR2, SIGNAL(clicked()), this, SLOT(changeColorRedDown()));
	connect(toolButtonG1, SIGNAL(clicked()), this, SLOT(changeColorGreenUp()));
	connect(toolButtonG2, SIGNAL(clicked()), this, SLOT(changeColorGreenDown()));
	connect(toolButtonB1, SIGNAL(clicked()), this, SLOT(changeColorBlueUp()));
	connect(toolButtonB2, SIGNAL(clicked()), this, SLOT(changeColorBlueDown()));
	
}

DownMenu::~DownMenu(){}

void DownMenu::changeColorRedUp(){
     if ( SWidget::color.red() < 240 ){
        SWidget::color.setRed(SWidget::color.red()+30);
        }
     if (SWidget::color.red()== 240 ) {
         SWidget::color.setRed(255);
         }
     }
void DownMenu::changeColorRedDown(){
     if (SWidget::color.red() > 0 && SWidget::color.red() <= 240 ) {
         SWidget::color.setRed(SWidget::color.red()-30);
         }     
     if ( SWidget::color.red() == 255 ){
        SWidget::color.setRed(240);
        }

     }
void DownMenu::changeColorGreenUp(){
     if ( SWidget::color.green() < 240 ){
        SWidget::color.setGreen(SWidget::color.green()+30);
        }
     if (SWidget::color.green()== 240 ) {
         SWidget::color.setGreen(255);
         }     
     }
void DownMenu::changeColorGreenDown(){
     if (SWidget::color.green() > 0 && SWidget::color.green() <= 240 ) {
         SWidget::color.setGreen(SWidget::color.green()-30);
         }     
     if ( SWidget::color.green() == 255 ){
        SWidget::color.setGreen(240);
        }     
     }
void DownMenu::changeColorBlueUp(){
     if ( SWidget::color.blue() < 240 ){
        SWidget::color.setBlue(SWidget::color.blue()+30);
        }
     if (SWidget::color.blue()== 240 ) {
         SWidget::color.setBlue(255);
         }     
     }
void DownMenu::changeColorBlueDown(){
     if (SWidget::color.blue() > 0 && SWidget::color.blue() <= 240 ) {
         SWidget::color.setBlue(SWidget::color.blue()-30);
         }     
     if ( SWidget::color.blue() == 255 ){
        SWidget::color.setBlue(240);
        }     
     }
